package sfin.controller;

import sfin.service.ConfigService;

public class ConfigController {

	private ConfigService configService;

	private int[][][] backgrounds;

	private boolean iniContaPadrao;
	private int dtPgtoIndex;

	public ConfigController(ConfigService configService) {
		this.configService = configService;
		initializeConfig();
	}

	private void initializeConfig() {
		backgrounds = configService.getBackColors();
		iniContaPadrao = configService.isInitContaPadrao();
		dtPgtoIndex = configService.getDtPgtoConfigOrdinal();
	}

	public int[][][] getBackgrounds(){
		return backgrounds;
	}

	public void setBackgrounds(int[][][] backgrounds){
		this.backgrounds = backgrounds;
	}
	
	public void setIniContaPadrao(boolean iniContaPadrao){
		this.iniContaPadrao = iniContaPadrao;
	}
	
	public boolean isIniContaPadrao(){
		return iniContaPadrao;
	}
	
	public void callSave(){
		configService.updateBackColors(backgrounds);
		configService.updateConfigs(iniContaPadrao,dtPgtoIndex);
	}

	public String[] getDtPgtoLabels(){
		return configService.getDtPgtoLabels();
	}
	
	public void setDtPgtoIndex(int dtPgtoIndex) {
		this.dtPgtoIndex = dtPgtoIndex;
	}
	
	public int getDtPgtoIndex() {
		return dtPgtoIndex;
	}
	
}